// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'dart:io';
import 'package:crypto/crypto.dart';
import 'package:package_info_plus/package_info_plus.dart';

void main() {
  runApp(const Test());
}

class Test extends StatefulWidget {
  const Test({super.key});

  @override
  State<Test> createState() => _TestState();
}

class _TestState extends State<Test> {
  var appName = "";
  var packageName = "";
  var version = "";
  var buildNumber = "";

  void initVersionInfo() async {
    PackageInfo packageInfo = await PackageInfo.fromPlatform();
    appName = packageInfo.appName;
    packageName = packageInfo.packageName;
    version = packageInfo.version;
    buildNumber = packageInfo.buildNumber;
  }

  @override
  void initState() {
    super.initState();
    Future.delayed(
      Duration.zero,
      () => setState(
        () {
          initVersionInfo();
          print("appName $appName");
          print("packageName $packageName");
          print("version $version");
          print("buildNumber $buildNumber");
        },
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Container();
  }
}
